package com.university.report.user.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.university.report.model.entity.ReportInfo;
import com.university.report.model.vo.ReportInfoVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Jinondo
 * @since 2021-06-09
 */
@Repository
public interface ReportInfoMapper extends BaseMapper<ReportInfo> {

    List<ReportInfoVO> selectByIdsNDate(@Param("ids") List<Integer> ids, @Param("date") String date);

    List<ReportInfoVO> selectByDepNDateFull(@Param("department") String department,
                                            @Param("from") String from,
                                            @Param("to") String to);

    List<ReportInfoVO> selectAll();

    /**
     * 查询某一天的打卡
     * @param from
     * @param to
     * @return
     */
    IPage<ReportInfoVO> selectBetweenDate(IPage<ReportInfoVO> page, @Param("from") String from,
                                         @Param("to") String to);

    List<ReportInfoVO> selectByTempNHealth(@Param("temperature") BigDecimal temperature,
                                           @Param("healthCon") String healthCon,
                                           @Param("from") String from,
                                           @Param("to") String to);

    List<ReportInfoVO> selectByImpRegionEQ1(@Param("from") String from,
                                         @Param("to") String to);

    List<ReportInfoVO> selectByUserIdSort(@Param("userId") Integer userId);

    /**
     * 根据userid获取最近的一次记录
     * @param userId
     * @return
     */
    ReportInfoVO selectOneByUserId(@Param("userId") Integer userId);

    IPage<ReportInfoVO> selectByCond(IPage<ReportInfoVO> page,
                                     @Param("department") String department,
                                     @Param("healthCon") Integer healthCon,
                                     @Param("impRegion") Integer impRegion,
                                     @Param("from") String from,
                                     @Param("to") String to);
}
